import Main from '@/views/Main.vue';

// 不作为Main组件的子页面展示的页面单独写，如下
export const loginRouter = {
    path: '/login',
    name: 'login',
    meta: {
        title: 'Login - 登录'
    },
    component: () => import('@/views/login.vue')
};

export const page404 = {
    path: '/*',
    name: 'error-404',
    meta: {
        title: '404-页面不存在'
    },
    component: () => import('@/views/error-page/404.vue')
};

export const page403 = {
    path: '/403',
    meta: {
        title: '403-权限不足'
    },
    name: 'error-403',
    component: () => import('@//views/error-page/403.vue')
};

export const page500 = {
    path: '/500',
    meta: {
        title: '500-服务端错误'
    },
    name: 'error-500',
    component: () => import('@/views/error-page/500.vue')
};

export const preview = {
    path: '/preview',
    name: 'preview',
    component: () => import('@/views/form/article-publish/preview.vue')
};

export const locking = {
    path: '/locking',
    name: 'locking',
    component: () => import('@/views/main-components/lockscreen/components/locking-page.vue')
};

// 作为Main组件的子页面展示但是不在左侧菜单显示的路由写在otherRouter里
export const otherRouter = {
    path: '/',
    name: 'otherRouter',
    redirect: '/home',
    component: Main,
    children: [
        { path: 'home', title: {i18n: 'home'}, name: 'home_index', component: () => import('@/views/home/home.vue') }, 
        { path: 'examinee-management', title: '考生管理', name: 'examinee-management', component: () => import('@/views/test-center/examination-room/examinee.vue')},
        { path: 'examination-set', title: '考场设置', name: 'examination-set', component: () => import('@/views/test-center/examination-room/list.vue')},
        { path: 'examination-increase', title: '增加考场', name: 'examination-increase', component: () => import('@/views/test-center/examination-room/add-increase.vue')},
        { path: 'examinee-into', title: '考生导入', name: 'examinee-into', component: () => import('@/views/test-center/examination-room/examinee-into.vue') },
        { path: 'examination-room', title: '消息中心', name: 'examinee', component: () => import('@/views/test-center/examination-room/examinee.vue') },
        { path: 'add-test', title: '添加试卷', name: 'add-test', component: () => import('@/views/test-center/test-management/add-test.vue') },
        { path: 'user-add', title: '添加用户', name: 'user-add', component: () => import('@/views/user-center/user-management/user-add.vue')},
        { path: 'user-alter', title: '修改用户', name: 'user-alter', component: () => import('@/views/user-center/user-management/user-alter.vue')},
        { path: 'test-particulars', title: '试卷详情', name: 'test-particulars', component: () => import('@/views/test-center/examination-room/test-particulars.vue')},
        { path: 'edit-test', title: '编辑试卷', name: 'edit-test', component: () => import('@/views/test-center/test-management/edit-test.vue') },
        { path: 'add-subject', title: '添加题目', name: 'add-subject', component: () => import('@/views/test-center/subject-management/add-subject.vue') },
        { path: 'edit-subject', title: '编辑题目', name: 'edit-subject', component: () => import('@/views/test-center/subject-management/edit-subject.vue') },
        { path: 'import-subject', title: '导入题目', name: 'import-subject', component: () => import('@/views/test-center/subject-management/import-subject.vue') },
        { path: 'examination-particulars', title: '考卷详情', name: 'examination-particulars', component: () => import('@/views/test-center/examination-room/examination-particulars')},
        { path: 'paper-browse', title: '试卷浏览', name: 'paper-browse', component: () => import('@/views/test-center/examination-room/paper-browse')},
        { path: 'compile-examination', title: '编辑考场', name: 'compile-examination', component: () => import('@/views/test-center/examination-room/compile-examination')},
        { path: 'preview-test', title: '预览试卷', name: 'preview-test', component: () => import('@/views/test-center/test-management/preview-test.vue') },
    ]
};

// 作为Main组件的子页面展示并且在左侧菜单显示的路由写在appRouter里
export const appRouter = [
    {
        path: '/user-center',
        icon: 'android-folder-open',
        name: 'user-center',
        title: '用户中心',
        component: Main,
        children: [
            { 
            	path: 'user-management', 
            	title: '用户管理', 
            	name: 'user-management', 
            	icon: 'person-stalker', 
            	component: () => import('@/views/user-center/user-management/list.vue'),
            },
            { path: 'grade-management', title: '成绩档案', name: 'grade-management', icon: 'document', component: () => import('@/views/user-center/grade-management/list.vue') }
        ]
    },
    {
        path: '/test-center',
        icon: 'ios-compose-outline',
        name: 'test-center',
        title: '考试中心',
        component: Main,
        children: [
            { path: 'subject-management', title: '题目管理', name: 'subject-management', icon: 'ios-folder-outline', component: () => import('@/views/test-center/subject-management/list.vue') },
            { path: 'test-management', title: '试卷配置', name: 'test-management', icon: 'ios-list-outline', component: () => import('@/views/test-center/test-management/list.vue') },
            { path: 'examination-room', title: '考场设置', name: 'examination-room', icon: 'android-clipboard', component: () => import('@/views/test-center/examination-room/list.vue') }
        ]
    }
];

// 所有上面定义的路由都要写在下面的routers里
export const routers = [
    loginRouter,
    otherRouter,
    preview,
    locking,
    ...appRouter,
    page500,
    page403,
    page404
];
